package main

import "fmt"

func main() {
	fmt.Println(subsets([]int{0}))
}

func subsets(nums []int) [][]int {
	var res [][]int
	var list []int
	var helper func(list []int, index int)
	helper = func(list []int, index int) {
		res = append(res, append([]int{}, list...))
		if index == len(nums) {
			return
		}

		for i := index; i < len(nums); i++ {
			list = append(list, nums[i])
			helper(list, i+1)
			list = list[:len(list)-1]
		}
	}
	helper(list, 0)
	return res
}
